<template>
{{#if page.psSysPFPlugin}}
    {{> @macro/plugins/view/view-use.hbs appPlugin=page.psSysPFPlugin}}
{{else}}
    {{#if page.psViewLayoutPanel.useDefaultLayout}}
    <AppSDViewLayout :class="classNames" :openType="openType">
        <template v-if="!noViewCaption && model.showCaption" #viewHeaderContentLeft>
            <div class="view-header__caption">
                {{> @macro/view/view-caption.hbs}}
                {{> @macro/view/view-datainfo-bar.hbs}}
            </div>
        </template>
        {{#hasCtrl page.ctrls 'TOOLBAR'}}
        <template #viewHeaderContentRight>
        {{#each page.ctrls as | ctrl |}}
            {{#eq ctrl.controlType 'TOOLBAR'}}
            <div class="view-header__toolbar">
                {{> @macro/widgets/toolbar/toolbar.hbs page=page ctrl=ctrl}}
            </div>
            {{/eq}}
        {{/each}}
        </template>
        {{/hasCtrl}}
        <template #default>
        {{#each page.ctrls as | ctrl |}}
            {{#eq ctrl.controlType 'DRBAR'}}
                {{> @macro/widgets/drbar-detail/drbar.hbs ctrl=ctrl}}
            {{/eq}}
            {{#eq ctrl.controlType 'FORM'}}
            {{> @macro/widgets/form-detail/form.hbs ctrl=ctrl props="v-show='!store.navParam.navViewName'"}}
            <component
                :is="store.navParam.navViewName"
                class="view-container2"
                openType="EMBED"
                :name="store.navParam.navViewName"
                :context="store.navParam.navData?.context"
                :viewParams="store.navParam.navData?.viewParams"
            />
            {{/eq}}
        {{/each}}
        </template>
        {{> @macro/view/view-msg.hbs}}  
    </AppSDViewLayout>
    {{else}}
    <div :class="classNames">
        {{#if page.psViewLayoutPanel.rootPSPanelItems}}
        {{#each page.psViewLayoutPanel.rootPSPanelItems as | panelItem |}}
        {{> @macro/widgets/panel-detail/include-panel.hbs type=panelItem.itemType item=panelItem isMultiData=false panel=page.psViewLayoutPanel page=page}}
        {{/each}}
        {{/if}}
    </div>
    {{/if}}
{{/if}}
</template>
<script lang="ts" setup>
// 基于template/src/views/\{{appModules}}/\{{pages@DEEDITVIEW2}}/\{{spinalCase page.codeName}}.vue.hbs生成
{{#if page.psViewLayoutPanel.useDefaultLayout}}
import { AppSDViewLayout } from "@components/layout/sd-view-layout";
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.ctrls}}
{{else}}
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';
{{#if page.psViewLayoutPanel.viewProxyMode}}
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.psViewLayoutPanel.psControls}}
{{else}}
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.ctrls}}
{{/if}}
{{/if}}
import { model } from "./{{spinalCase page.codeName}}-model";
import { 
    useNavParamsBind, 
    useEventBind, 
{{#page.ctrls}}
  {{#eq controlType 'TOOLBAR'}}
    handleToolbarItemClick,
  {{/eq}}
{{/page.ctrls}}
    handleCtrlAction, 
    handleCtrlInit, 
    handleCtrlDestroy, 
    getViewClassNames,
{{#unless page.psViewLayoutPanel.useDefaultLayout}}
    handleComponentAction,
{{/unless}}
} from "@/hooks/use-view";
import { EditView2ActionType, IParam, IEditView2Ability, IEditView2ControllerParams, IEditView2Store, EditView2Controller, ILoadingHelper, srfFilePath2, IContext, IEditView2Controller, IEvent } from '@/core';

{{> @macro/view/view-props.hbs}}

{{> @macro/common/emit.hbs name="view" actionType="EditView2ActionType" ability="IEditView2Ability"}}

//  样式名称
const classNames = computed(() => {
    return getViewClassNames(model, props);
});

const params: IEditView2ControllerParams<EditView2ActionType, IEditView2Ability> = {
    name: props.name,
    model, 
    evt, 
    isLoadDefault: props.isLoadDefault,
    openType:props.openType,
    pLoadingHelper:props.pLoadingHelper, 
    handler: (data: IEditView2Store) => { return reactive(data); } 
};
{{> @macro/common/controller.hbs name="view" IController="IEditView2Controller" store="IEditView2Store" ability="IEditView2Ability" controller="EditView2Controller"}}
</script>
